<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="s_key_produce" :rules="rules" label-width="100px" id="mvcfm">
      <el-button @click="popProductSeriesCruxSet('&category_id=')" type='primary' size="mini">选择关键件</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 产品列表 </span>
      </div>
      <el-table :data="s_key_produce">
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <el-link @click="d_key_produce('&CMID2='+scope.row.keyproduce_id+'')">移除</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="产品条形码" prop="product_barcode">
        </el-table-column>
        <el-table-column label="产品名称" prop="product_name">
        </el-table-column>
        <el-table-column label="产品型号" prop="product_model">
        </el-table-column>
        <el-table-column label="产品规格" prop="product_norm">
        </el-table-column>
        <el-table-column label="产品描述" prop="product_des">
        </el-table-column>
        <el-table-column label="产品数量" prop="keyproduce_no">
        </el-table-column>
      </el-table>
    </el-form>
    <el-dialog :visible.sync="ProductSeriesCruxSetVisible" append-to-body>
      <ProductSeriesCruxSet v-if="ProductSeriesCruxSetVisible" ref="ProductSeriesCruxSet" :popparams="popparams"> </ProductSeriesCruxSet>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import ProductSeriesCruxSet from "@/views/psi/product/ProductSeriesCruxSet";
  export default {
    name: 'ProductSeriesCruxList',
    components: {
      ProductSeriesCruxSet,
    },
    props: ['popparams'],
    data() {
      return {
        ProductSeriesCruxSetVisible: false,
        ProductSeriesCruxSetValue: null,
        ProductSeriesCruxSetDesc: null,
        vueparams: this.getVUEParams(""),
        s_key_produce: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/product/ProductSeriesCruxList/productSeriesCruxList?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_key_produce(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/product/ProductSeriesCruxList/d_key_produce?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      popProductSeriesCruxSet(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.ProductSeriesCruxSetVisible = !this.ProductSeriesCruxSetVisible;
      },
    },
  }
</script>
